package com.claude.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by Claude on 2014/12/5.
 */
public class Check {
    public static boolean isConnected(Context context){
        if(context != null){
            ConnectivityManager manager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo info = manager.getActiveNetworkInfo();
            if(info != null){
                //Get the connect state
                return info.isAvailable();
            }else{
                //Cannot access the system service
                return false;
            }
        }else{
            //Context not exist
            return false;
        }
    }
}
